package com.yidu.verycd_background.service.impl;
import com.yidu.verycd_background.dao.VerycdTicketsDao;
import com.yidu.verycd_background.entity.VerycdTickets;
import com.yidu.verycd_background.service.VerycdTicketsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (VerycdTickets)表服务实现类
 *
 * @author makejava
 * @since 2020-07-27 09:55:08
 */
@Service("verycdTicketsService")
public class VerycdTicketsServiceImpl implements VerycdTicketsService {
    @Resource
    private VerycdTicketsDao verycdTicketsDao;

    /**
     * 通过ID查询单条数据
     *
     * @param ticId 主键
     * @return 实例对象
     */
    @Override
    public VerycdTickets queryById(Integer ticId) {
        return this.verycdTicketsDao.queryById(ticId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<VerycdTickets> queryAllByLimit(int offset, int limit) {
        return this.verycdTicketsDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param verycdTickets 实例对象
     * @return 实例对象
     */
    @Override
    public VerycdTickets insert(VerycdTickets verycdTickets) {
        this.verycdTicketsDao.insert(verycdTickets);
        return verycdTickets;
    }

    /**
     * 修改数据
     *
     * @param verycdTickets 实例对象
     * @return 实例对象
     */
    @Override
    public VerycdTickets update(VerycdTickets verycdTickets) {
        this.verycdTicketsDao.update(verycdTickets);
        return this.queryById(verycdTickets.getTicId());
    }

    /**
     * 通过主键删除数据
     *
     * @param ticId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer ticId) {
        return this.verycdTicketsDao.deleteById(ticId) > 0;
    }
}